package linkedlist;

/**
 * @author tong
 * @date 2022/1/7 11:23
 * 环形单项链表
 */
public class CircleSingleLinkedList {
    private Node<Person> head = new Node<>(new Person());

    public CircleSingleLinkedList() {
        head.next=head;
    }

    public void add(Node<Person> node) {
        Node<Person> temp = head;
        while (temp.next != head) {
            temp = temp.next;
        }
        node.next = head;
        temp.next = node;

    }
}
